package com.novax.ex.activity.open.api.inner;

import com.novax.ex.activity.open.model.request.OperationContentRequest;
import com.novax.ex.activity.open.model.response.OperationContentResponse;
import com.novax.ex.common.results.ReturnResult;
import com.novax.ex.common.util.PageUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import jakarta.validation.Valid;

/**
 * @Description 活动落地页文案
 * @Author ChenXi
 * @Date 2023/04/18/10:48
 */

@Tag(name = "后台-活动落地页文案", description = "后台-活动落地页文案")
@FeignClient(url = "${remote.activity-service.endpoint}", name = "OperationContentApi", contextId = "OperationContentApi")
public interface OperationContentApi {

    @Operation(summary = "查询活动所有文案")
    @GetMapping("/v3/private/operation/content")
    ReturnResult<PageUtil<OperationContentResponse>> page(@RequestHeader("language") String language,
                                                 @RequestParam("operationId") Long operationId);

    @Operation(summary = "查询")
    @GetMapping("/v3/private/operation/content/query")
    ReturnResult<OperationContentResponse> query(@RequestHeader("language") String language,
                                                 @RequestParam("id") Long id);

    @Operation(summary = "新增")
    @PostMapping("/v3/private/operation/content/add")
    ReturnResult<?> add(@RequestHeader("languages") String languages,
                        @Valid @RequestBody OperationContentRequest operationContentRequest,
                        BindingResult bindingResult);

    @Operation(summary = "修改")
    @PutMapping("/v3/private/operation/content/{id}")
    ReturnResult<?> modify(@RequestHeader("languages") String languages,
                           @PathVariable Long id,
                           @Valid @RequestBody OperationContentRequest operationContentRequest,
                           BindingResult bindingResult);

    @Operation(summary = "删除")
    @DeleteMapping("/v3/private/operation/content/{id}")
    ReturnResult<?> remove(@RequestHeader("language") String language,
                                         @PathVariable Long id);

}
